export const state = () => ({
    list: []
})
export const mutations = {
    addHistory(state, data) {
//校验历史记录是否有重复
        let existed = false;
        state.list.forEach(ele => {
            if (ele.departCode == data.departCode &&
                ele.destCode == data.destCode &&
                ele.departDate == data.departDate
            ) {
                existed = true
            }
        })
        if (!existed) {
            state.list.push(data)
        }

    },
    clearHistory(state, data) {
        state.list = data
    }
}